import math
from fractions import Fraction


def gcd(a, b):
    """计算最大公约数"""
    while b:
        a, b = b, a % b
    return a


def input_decimal():
    """从标准输入读取小数"""
    decimal = input("请输入一个小数：")
    return decimal


def decimal_to_fraction(decimal):
    """将小数转换为分数"""
    # 分离整数部分和小数部分
    integer_part, _, fraction_part = decimal.partition('.')

    # 转换整数部分为分数
    if integer_part:
        integer_fraction = Fraction(int(integer_part), 1)
    else:
        integer_fraction = Fraction(0, 1)

        # 处理小数部分
    if fraction_part:
        # 将小数部分转换为分数
        denominator = 10 ** len(fraction_part)
        fraction_fraction = Fraction(int(fraction_part), denominator)

        # 合并整数部分和小数部分的分数
        combined_fraction = integer_fraction + fraction_fraction

        # 化简分数
        numerator, denominator = combined_fraction.numerator, combined_fraction.denominator
        common_gcd = gcd(numerator, denominator)
        numerator //= common_gcd
        denominator //= common_gcd

        # 判断是否需要转换为几又几分之几的形式
        if numerator == 0:
            return integer_fraction.numerator, 0, 1
        else:
            mixed_num_whole = integer_fraction.numerator
            mixed_num_numerator = numerator
            mixed_num_denominator = denominator
            return mixed_num_whole, mixed_num_numerator, mixed_num_denominator
    else:
        # 如果小数部分为空，则只返回整数部分
        return integer_fraction.numerator, 0, 1


def main():
    # 读取小数
    decimal = input_decimal()

    # 转换小数为分数
    integer_part, numerator, denominator = decimal_to_fraction(decimal)

    # 输出结果
    print(integer_part, numerator, denominator)


if __name__ == "__main__":
    main()